#include <stdio.h>
#include <math.h>

int main() {
	int m, i, x;
	scanf ( "%d", &m);
	x = m;
	for (i = 2; i <= sqrt(m); i++)
		if (m % i == 0) {
			x = 0;
			break;
		}
	printf ("%d", x);
}
